from django.urls import path, re_path

from Z import views
from Z.views import AddArticleView, ArticleDetailView, ArticleUserView, ArticleUpdateView, ArticleDelete

urlpatterns = [
    path('test/', views.test),
    # path('test/<str:info>', views.test),
    # <转换器的类型：参数名>  参数名接收路由传过来的数据
    #     path('TCL',views.TCL),
    re_path('^re_TCL/(?P<info>[0-9abc]+)/$', views.TCL),  # info 保存的是地址里的参数字符
    #     正则 ‘^re_TV/(?p<info>[0-9abc]+)/$’
    # ^以什么开始 $以什么结束  （）把符合规则的字符保留下来传给info []限制参数字符只能有数字和abc字母组成  +字符个数的限制一次及以上
    path('nav/<str:classes>', views.nav),
    path('404/', views.not_found, name=' not_found'),
    path('index/', views.index, name='index'),
    path('classes/', views.classes, ),
    path('tab_info/', views.tab_info),
    path('article/add/', AddArticleView.as_view(), name='AddArticle'),
    path('article/<int:id>/', ArticleDetailView.as_view(), name='ArticleDetail'),
    path('article/user/', ArticleUserView.as_view(), name='ArticleUser'),
    path('article/update/<int:id>', ArticleUpdateView.as_view(), name='ArticleUpdate'),
    path('article/delete/<int:id>', ArticleDelete.as_view(), name='ArticleDelete'),

]
